# include <bits/stdc++.h>
# define MAXN 100000023
using namespace std;

int n;
vector <int> pri;
bool np[MAXN];
unsigned long long ans;

int main() { 
    freopen("ghostprime.in","r",stdin);
    freopen("ghostprime.out","w",stdout);
    cin >> n;
    for(register int i = 2; i < n; i++) { 
        if(!np[i]) { 
            pri.push_back(i);
            np[i] = 1;
            ans += i;
        } 
        register int temp = pri.size();
        for(register int j = 0; j < temp ; j++) { 
            register int k = i * pri[j];
            if(k >= n) break;
            np[k] = 1;
            if(!(i % pri[j])) break;
        }
    }
    cout << ans;
}
